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

Query time 0.00050