UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7u3yHwoTsdxNs6LQ9SWlHOJRAJUkw4HzLUzM9C7/DPQ=' 
WHERE 
  key_id = 'e9f07d8a48f90d14b0a71e9b2d4b7ffd6ecaff5ecb47f328ca0b3d383ee0173b' 
  AND (
    token = '7u3yHwoTsdxNs6LQ9SWlHOJRAJUkw4HzLUzM9C7/DPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031