UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TA1CSaL/3DaQuYjGa6RUCOHvCmx1o1KN9NuUi3d7fe8='
WHERE
key_id = 'a75b2187ae8b019fffcd63f69a4f97046ccc5fd219b485b102ef3d7c15380459'
AND (
token = 'TA1CSaL/3DaQuYjGa6RUCOHvCmx1o1KN9NuUi3d7fe8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)