UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YuDKgd2LQVy89k8IHJJnzbCNRRdWM6+qGuqXX44pCf8='
WHERE
key_id = '4ea45f1e2258f75c52bd69ecc12b2e8d76e2ac18e7206278e20b104fc0174a73'
AND (
token = 'YuDKgd2LQVy89k8IHJJnzbCNRRdWM6+qGuqXX44pCf8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)