UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3PMEmafDF29ontush4EGaCEE2lEHFMN2VIwiQaolE2E=' 
WHERE 
  key_id = 'c5c52d6b54cdaa61ff4657f9c031db483e0b522129888a3417ce62346877d249' 
  AND (
    token = '3PMEmafDF29ontush4EGaCEE2lEHFMN2VIwiQaolE2E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031