UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OBG25C2Gg9Zu2zw+JLBgQJVwrzluZOepdbrZ63bWEjk=' 
WHERE 
  key_id = '9920b8c9a33342680d758fb16c9852497aa5666e0571b1314ccaebc301c39b59' 
  AND (
    token = 'OBG25C2Gg9Zu2zw+JLBgQJVwrzluZOepdbrZ63bWEjk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023