UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uyzFvqbLEMOgtHrR/NL7tVvBah4idWmN+bmn8u8Sh8Q=' 
WHERE 
  key_id = '8e8aea3387569d545609d2e7ff368538fd89389b3a8040963904d152cf6a323e' 
  AND (
    token = 'uyzFvqbLEMOgtHrR/NL7tVvBah4idWmN+bmn8u8Sh8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026