UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nNOLrVF9kihYMxT8o/OdyZE4tqK7XqheTTaXa9S6Wtk=' 
WHERE 
  key_id = '3e82d83466d42f6e70417c57c850cd707df18fe3725be0eb6f6a9f0b59147488' 
  AND (
    token = 'nNOLrVF9kihYMxT8o/OdyZE4tqK7XqheTTaXa9S6Wtk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023