UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jkbhP4hKkCMrolaHUL6Kcmua8q0+pdbVcmg4yhHqsiw=' 
WHERE 
  key_id = '12a43dc9ad3b1685c54a26186f8a29533406fba5be8249e56c1e6925feb42315' 
  AND (
    token = 'jkbhP4hKkCMrolaHUL6Kcmua8q0+pdbVcmg4yhHqsiw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029