UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wa8yhMZj0uXk7YTTpq77ZV6sjkVywcNjtMknJg2Vxkw=' 
WHERE 
  key_id = '9142de2bf5c2bbc9c444bd976343da44828628c76763164d38b2c0de74b16b7b' 
  AND (
    token = 'Wa8yhMZj0uXk7YTTpq77ZV6sjkVywcNjtMknJg2Vxkw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048