UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WA+huBviRpDbgYvARx+PjZ2vxQcoZqfBBUvlS4t5Qek='
WHERE
key_id = '74badbfb46452bb627051cec33fdd156b4384d6ba8a2971face3d6361caaa3cb'
AND (
token = 'WA+huBviRpDbgYvARx+PjZ2vxQcoZqfBBUvlS4t5Qek='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)