UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9J6mIiF7/jumR+vav9aY2g2UfY1YApI7AEPg3WL6CTs=' 
WHERE 
  key_id = '4c23b7e4002864317553906db0dd6ab2f6813823293eca99f3e319e09c7929a4' 
  AND (
    token = '9J6mIiF7/jumR+vav9aY2g2UfY1YApI7AEPg3WL6CTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019