UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tBV8VAioyDu3tsqOP1T+ZVginh1xZIbFyGtTVoKZ4sk=' 
WHERE 
  key_id = '454347a1cb6286ce45db0c77c8772925a7bf11e5695c36e7356021213185d425' 
  AND (
    token = 'tBV8VAioyDu3tsqOP1T+ZVginh1xZIbFyGtTVoKZ4sk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052