UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KOHklpj4c3RPZx+oJe/dYOhT8j1ObXOy4n2C6JkJpE4=' 
WHERE 
  key_id = '634f3a49effc7c40c4bd53f642a18c48f3e7c4bf5238668bdc99197a827297ff' 
  AND (
    token = 'KOHklpj4c3RPZx+oJe/dYOhT8j1ObXOy4n2C6JkJpE4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035