UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd7A1GXaaIttymN9bS6kdS7MI9dgPGBdIW5pBzMCGwus=' 
WHERE 
  key_id = '3142b36e14750e9388efb5b285d9317e726bc7f229d519fafdb095682439f8b6' 
  AND (
    token = 'd7A1GXaaIttymN9bS6kdS7MI9dgPGBdIW5pBzMCGwus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035