UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RoelOOrO7GutPIfRfjBgnItO9cTNDPwRRAK/e6X1xoY='
WHERE
key_id = 'a71e5235d464a0963e514ce1944315429f7b7a180da8e3b9cc407e5bbcd745ad'
AND (
token = 'RoelOOrO7GutPIfRfjBgnItO9cTNDPwRRAK/e6X1xoY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)