UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd+bWltDQE6ry0Pb5YdqpX7GuJLqr9mZKmb/mwnlXGck='
WHERE
key_id = '87f2899cfc33e660def1f180b91cc4f7a259d4843925891b992be68a6996c5e9'
AND (
token = 'd+bWltDQE6ry0Pb5YdqpX7GuJLqr9mZKmb/mwnlXGck='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)