UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lqjKnJORl4y/VU/5GtiXVDoQs/bpDI/Es5LFBPIr/2o=' 
WHERE 
  key_id = '0c628773e9c315b82dd7a5843e4ee6e8776441256519ab9b3c920be2804a8808' 
  AND (
    token = 'lqjKnJORl4y/VU/5GtiXVDoQs/bpDI/Es5LFBPIr/2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043