UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IDoa4BvQiytKyShpi5H9MZsqfulbYOq+LcgzhBN2aH4='
WHERE
key_id = '1a2e1b2aa79f843cf7d356f7ddcdde7dd5b3b94c849910c310700097051a4959'
AND (
token = 'IDoa4BvQiytKyShpi5H9MZsqfulbYOq+LcgzhBN2aH4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)