UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zBXHrfx4GYL7T0HE391n42cQZGYYOncCSVXmYHfBgxY=' 
WHERE 
  key_id = '84cb37c6fb77c8f8d9d42131066619057b9e51e165fb8b77ffa85cfb1e9239b7' 
  AND (
    token = 'zBXHrfx4GYL7T0HE391n42cQZGYYOncCSVXmYHfBgxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021