UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q044fppfEqJ3jCFlFEnga+loXOecL5Mu7hZPSgkjgpk=' 
WHERE 
  key_id = '54be310583ba9abfa71fa1b175b5e2fde5890ac98c676628425171f02704f747' 
  AND (
    token = 'Q044fppfEqJ3jCFlFEnga+loXOecL5Mu7hZPSgkjgpk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026