UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bi+ztCVhbFdXzoTf4JUTWc6qbQYCcHAXPP4Dhtsb3Y8='
WHERE
key_id = '6e7c4c61121ce9434759b8973ba64076eaf8ab608b072ad0aa93b049cea76465'
AND (
token = 'bi+ztCVhbFdXzoTf4JUTWc6qbQYCcHAXPP4Dhtsb3Y8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)