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