UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FVAAyd8vu+66E4KYYwI2AJwkHrhoRSJw1X2YMxa5RNU=' 
WHERE 
  key_id = '7fce5628f9cb0bb9b7aa16eea8a84f219b21b9e90f418ba7c540cb2c52677447' 
  AND (
    token = 'FVAAyd8vu+66E4KYYwI2AJwkHrhoRSJw1X2YMxa5RNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045