UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sSoeDIPDrLRisG0jgE/Mx54cvGfLqyDmUrOqYdUponw='
WHERE
key_id = 'd5521c4c3ab07f535bd566daa51fafeae8ef47075a977d8ab2b46fcb6d17062b'
AND (
token = 'sSoeDIPDrLRisG0jgE/Mx54cvGfLqyDmUrOqYdUponw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)