UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hvAJrIy5EmXDXCY0+Y9tW1gHnHzk015xJ3mczM9Xdqc='
WHERE
key_id = '91d1f8d718b1562ee8f93a4b45ff18e28318fe8f814d34e60e5d530f0d222df3'
AND (
token = 'hvAJrIy5EmXDXCY0+Y9tW1gHnHzk015xJ3mczM9Xdqc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)