UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YW9/YWWNGa3eg5bA24LADQA+uQDV8aDX6qSJtFXP7a8='
WHERE
key_id = '015c782aabee8aafc8c4822782a8c4b1244aae2d0b50b920045ed569e8abeb55'
AND (
token = 'YW9/YWWNGa3eg5bA24LADQA+uQDV8aDX6qSJtFXP7a8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)