UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9JN4b2/0q8YC56xc0gYZ/N57OwCBZGjcUoulaZswom8='
WHERE
key_id = 'be12145eedc5f70f779c2adcfc60e7cb146b2c646dc02f8f487c4506905e82cf'
AND (
token = '9JN4b2/0q8YC56xc0gYZ/N57OwCBZGjcUoulaZswom8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)