UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nkmBMBXKUwkD0CT4od6fw2KiWJFJArqdwi8YToE7XqM='
WHERE
key_id = 'bb610c0329617536c3fac333c653c74ebd47d034a840fb0a8d794f15c8eadffd'
AND (
token = 'nkmBMBXKUwkD0CT4od6fw2KiWJFJArqdwi8YToE7XqM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)