UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6XGoYM9lNHp3Zfe0THfkZqkblNVLbIlga7jp6Si9xro='
WHERE
key_id = 'b26b4872f0d5ccf5b5b763f89f082664090730189462ef5e8555207e2007e9ab'
AND (
token = '6XGoYM9lNHp3Zfe0THfkZqkblNVLbIlga7jp6Si9xro='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)