UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZbD1basVtnLw6sZFmzbw+Y6vyD7zU810gO4U91BUuCs='
WHERE
key_id = '1b087beb100feb9f97562b450f953a474aa1d51797d43a1efc6894a273be167a'
AND (
token = 'ZbD1basVtnLw6sZFmzbw+Y6vyD7zU810gO4U91BUuCs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)