UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bJZEEZ3m9wg8aED2bLO8ABnuSA+RMegw0KUSfjYy320='
WHERE
key_id = 'f931310a73a1b599531138638f9fb3204a3632637989c33b1c33188ce3b473c6'
AND (
token = 'bJZEEZ3m9wg8aED2bLO8ABnuSA+RMegw0KUSfjYy320='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)