UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RwgHy71E6CAVd33rSKgnh+yTNfV+2Sk9Wo/Erqeurho='
WHERE
key_id = '697bd107090c42ea23b40cbdc0aa9f22cca7f08ed97daecc85093d88369dd65f'
AND (
token = 'RwgHy71E6CAVd33rSKgnh+yTNfV+2Sk9Wo/Erqeurho='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)