UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hknoc+AokvCqJ9CkXqXd34NTNhPNzi2GojWACb07gGU=' 
WHERE 
  key_id = '07868a42dc501499491b549049a1459aa5a627f3b3cef1b31b4f1d4bf9f51b44' 
  AND (
    token = 'Hknoc+AokvCqJ9CkXqXd34NTNhPNzi2GojWACb07gGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050