UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JOpWY9mTlBIIKGOHXtjOumGQKpwj52uIoayB96VzRxo='
WHERE
key_id = '78a425f5ba9a6de156a68abad915a3e6d2efa0edaaff656a92c8b707f73b9bc1'
AND (
token = 'JOpWY9mTlBIIKGOHXtjOumGQKpwj52uIoayB96VzRxo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)