UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6egaZJNaNWluQHehY7KotXiQm3TzGEctGOAkV5KA7oY=' 
WHERE 
  key_id = '7d51d5b30e6e144a27922374bf95b01e5b6d3c844fe364f9501cf80cffecde04' 
  AND (
    token = '6egaZJNaNWluQHehY7KotXiQm3TzGEctGOAkV5KA7oY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033