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