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