UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ehAaLm43JModon75da5yz+dZALuV8g9M38JptC4QS70='
WHERE
key_id = '8e8ab7e5d8fc4384799cdd97027c40df5d322dd717704253a54be4438f515fe9'
AND (
token = 'ehAaLm43JModon75da5yz+dZALuV8g9M38JptC4QS70='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)