UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xp7Nw0R/ECEuXMBwZtb1zrwCw0jx94ofEinTxmLkvag=' 
WHERE 
  key_id = '187f67ee6a89047dc722c250d2a55d09bb68fdcc1b57b5e042f559bf5d691de4' 
  AND (
    token = 'Xp7Nw0R/ECEuXMBwZtb1zrwCw0jx94ofEinTxmLkvag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030