UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TAMuVZB9PV48p0Ix/1xvIytrks4M8ssQO0JfWxe2ta4='
WHERE
key_id = 'e305eb057af9b2a8640d49d013cd82ce80b605203e80fa757dc40ce915a226e3'
AND (
token = 'TAMuVZB9PV48p0Ix/1xvIytrks4M8ssQO0JfWxe2ta4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)