UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NpccxSKcV31TlHdkYBpCCDMgk9tptCysgjKwfUe4pNE=' 
WHERE 
  key_id = 'b4692dbce01f9e9a03354e34acea91b9d1edf84b1af46e6269fafb201f2a873a' 
  AND (
    token = 'NpccxSKcV31TlHdkYBpCCDMgk9tptCysgjKwfUe4pNE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017