UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EcIA8uqFowUs9M4ex729znFUPyMiWxaYj4SiDH490yU=' 
WHERE 
  key_id = '47ddb8afef266394871b3733c78eb0c2392e25e5d1a336bc6b82afa5821148b0' 
  AND (
    token = 'EcIA8uqFowUs9M4ex729znFUPyMiWxaYj4SiDH490yU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019