UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X/hTMClqvDMpBfOs2gEt0iztmPsgTorn7uMITW9gY1w=' 
WHERE 
  key_id = 'c2c3a5eea79594d1be7be39b909ef4e9ea45936e5a387ab1d2ddcffd385d8d5a' 
  AND (
    token = 'X/hTMClqvDMpBfOs2gEt0iztmPsgTorn7uMITW9gY1w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027