UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9+Zef6IvpPsnwEI5UT5GiuSuuBxZy9clSrgJcArV1nw='
WHERE
key_id = 'a0c3f77a6a98c23efc32efbc77f8d957f2e502e7accb655b415e74604c8ac640'
AND (
token = '9+Zef6IvpPsnwEI5UT5GiuSuuBxZy9clSrgJcArV1nw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)