UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jRJuNBGRnzQvgW75urGX57i5zwIP6C4Io97Gxuj5U5k='
WHERE
key_id = 'd34263b69a4ce8e89495312d23df1a733dbd2475a1531720fcb6c09512c61335'
AND (
token = 'jRJuNBGRnzQvgW75urGX57i5zwIP6C4Io97Gxuj5U5k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)