UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1KafNjSC1NQjVKI7sYND0k605N90oExWDyYbQTcbBvs='
WHERE
key_id = '3d714017d593a46b361ab854405a5ab098070cdf07c1b5b3c5dfa576e96e8c40'
AND (
token = '1KafNjSC1NQjVKI7sYND0k605N90oExWDyYbQTcbBvs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)