UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7bgKJgEDjJxrOpqA/m/M8S2gnVgDcGSre9lJuk2OSGo=' 
WHERE 
  key_id = '77a713f8e91544998568b7a2b63e8782efab01a2786ccef7a7cc37e808193a74' 
  AND (
    token = '7bgKJgEDjJxrOpqA/m/M8S2gnVgDcGSre9lJuk2OSGo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047