UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aoPlr2Bm6ai3xp/HoUQwEE0Jzahik+zsG/MW0ndm84w='
WHERE
key_id = '6747ab4940512ffa35fce9a15710e065cd2a221271e6e44e2c9eb8a81361f768'
AND (
token = 'aoPlr2Bm6ai3xp/HoUQwEE0Jzahik+zsG/MW0ndm84w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)