UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AVYOkBGTmjiftxCzvaqE1wXCssdbfJC4RJaS5LL8rpY='
WHERE
key_id = '24ca1ac86a52940291bf6ec51c1550353288aaa8d19c51a5c5121bb2652c1b5f'
AND (
token = 'AVYOkBGTmjiftxCzvaqE1wXCssdbfJC4RJaS5LL8rpY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)