UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SEG2VwglUZtD5IiQk+yHB+dAsyuMQczMeAxw2XdxYM0='
WHERE
key_id = '8511c76159ba45c416dba657f8f0591affaca15defc088222f2e1498fe29abfb'
AND (
token = 'SEG2VwglUZtD5IiQk+yHB+dAsyuMQczMeAxw2XdxYM0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)