UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aoCsWXrqs8Jxj3XfvMCfhgJfRjS5CcrKDZ4mQBDKP3w='
WHERE
key_id = '9e1f067155a088f3fbbd95ae4e9f3e7dd5ab357a8322257993ff9850de66d66d'
AND (
token = 'aoCsWXrqs8Jxj3XfvMCfhgJfRjS5CcrKDZ4mQBDKP3w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)