UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8YKRvlaXPY2ePlYu366pvUeBgYto9OszGZzVS3ZsQVY='
WHERE
key_id = '70f8840e3ebc86f81945589cc6724da53128f88a60e47074fd000b2c157752a9'
AND (
token = '8YKRvlaXPY2ePlYu366pvUeBgYto9OszGZzVS3ZsQVY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)