UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RXa5i00XN+eJCrepp5Ga5afg54mdzEulddTLp5wdFKY='
WHERE
key_id = 'a9a38e3d828ddc6f0f63bcd847fdd91fb1c27be237ed814e0c02f0a203d414ac'
AND (
token = 'RXa5i00XN+eJCrepp5Ga5afg54mdzEulddTLp5wdFKY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)