UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eOwM1bfXpj0vydSa97nrAcubcRzp1x9KPZ8klj86nXY='
WHERE
key_id = '240b14db3f3b1a379fcf84e3b23230592c63cf177eaddf483b3b025b5d649841'
AND (
token = 'eOwM1bfXpj0vydSa97nrAcubcRzp1x9KPZ8klj86nXY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)