UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KOuU/KUUSYC/MUHeSzoMo1nOIWhcy3kav7NmNyZX4FA=' 
WHERE 
  key_id = '4b9037b2a5d43479a541dae28908405b39dceefb5b1ac961d3a08a925f710d65' 
  AND (
    token = 'KOuU/KUUSYC/MUHeSzoMo1nOIWhcy3kav7NmNyZX4FA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037