UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BJzbMJPUbNXYycAex/7815qZ1P4xA7Uo3BTYVJSca/E='
WHERE
key_id = 'b731d4480baf8f43b661671a612ad941031c6cbf43bcbe7e328f2b02404b5a30'
AND (
token = 'BJzbMJPUbNXYycAex/7815qZ1P4xA7Uo3BTYVJSca/E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)