UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NmBUwB0L+e007E5BAleKi3EccMpbH3ZINboRig9ed4U=' 
WHERE 
  key_id = '80f4d4a75dc52dcf560f6dc5ac50c2a4a17c39811ebaf1266a866ab8832a72a9' 
  AND (
    token = 'NmBUwB0L+e007E5BAleKi3EccMpbH3ZINboRig9ed4U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037